#Copyright 2013 - Bill Dengler
#Clifs is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#Clifs is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with Clifs.  If not, see http://www.gnu.org/licenses
#class declarations
class component(object):
    pass

class engine(component):
    thrust=0
    running=False


class nose(component):
    position=0
    def turn(self):
        "turns the wheel. Returns 0 on success and 1 on failure."
        position=int(input("Enter position. Possible values are from 0 to 359:"))
        #check for smartasses
        if (position < 0):
            print("enter a number greater than or equal to 0.")
            return(1)
        if (position > 359):
            print("No, Nick Gawronski!")
            return(1)
        #smartass checks done, so set the position now.
        self.position=position
        print("wheel turned to ",self.position)
        return 0
class binarystate(component):
    state=False
    True_state_name="True"
    False_state_name="False"
    type="generic binary state component"
    def toggle(self):
        "toggles the state of a binary state component. Returns 0 on success and 1 on failure."
        if (self.state == True ):
            self.state=False
            self.print_state()
            return(0)
        if (self.state == False ):
            self.state=True
            self.print_state()
            return(0)
    def print_state(self):
        if (self.state == False):
            print(self.type," : ",self.False_state_name)
        if (self.state == True):
            print(self.type," : ",self.True_state_name)

class flaps(binarystate):
    state=False
    True_state_name="up"
    False_state_name="down"
    type="flaps"

class gear(binarystate):
    state=True
    True_state_name="extended"
    False_state_name="retracted"
    type="landing gear"


class aircraft(object):
    engine=engine()
    nose=nose()
    flaps=flaps()
    gear=gear()
    altitude=0
    bank=0
    pitch=0
    #aircraft functions
    def status(self):
        print("status report : ")
        print("nose : ",self.nose.position)
        self.flaps.print_state()
        self.gear.print_state()
        print("altitude : ",self.altitude)
        print("pitch : ",self.pitch)
    def widodo(self):
        import time
        print("You yell, \"This is our heading!\" and take another bite of your baconator burger.")
        time.sleep(10)
        print("you take another bite of your Baconator, and open up another can of your favorite beer.")
        beer=input("What is your favorite beer?")
        print("You continue to sip your ",beer)
        time.sleep(4)
        print("Alarms sound, which you ignore. After all, those other morons can handle the problem! You just want to sip your ",beer," and be done with it!")
        print("Your ",beer," falls out of your hand and onto the ground as the aircraft crashes!")
        exit(1)

